class Solution {
public:
    vector<int> missingTwo(vector<int>& nums) {
        int sum = 0, n = nums.size();
        for(int i = 1; i <= n + 2; ++i)
        {
            nums.push_back(i); // 转换成找两个单身狗->力扣260
        }
        n = nums.size();
        for (int i = 0; i < n; i++)
        {
            sum ^= nums[i];
        }
        int count = 0;
        for (int i = 0; i < 32; i++)
        {
            if (sum & 1 << i) //循环判断第几位是1
            {
                count = i;//如果是1 记录下来
                break;
            }
        }
        int a = 0, b = 0;
        for (int i = 0; i < n; i++)
        {
            if (nums[i] & 1 << count)
                a ^= nums[i];
            else
                b ^= nums[i];
        }
        return {a, b};
    }
};